#ifndef SOFT_TIMER_H
#define SOFT_TIMER_H

#include "system_config.h"
#include "event.h"


#if 	SOFT_TIMER_RECORD_TYPE == 0
typedef unsigned char				soft_timer_t;
#elif SOFT_TIMER_RECORD_TYPE == 1
typedef unsigned short			soft_timer_t;
#elif SOFT_TIMER_RECORD_TYPE == 2
typedef unsigned int				soft_timer_t;
#elif SOFT_TIMER_RECORD_TYPE == 3
typedef unsigned long				soft_timer_t;
#elif SOFT_TIMER_RECORD_TYPE == 4
typedef unsigned long	long	soft_timer_t;
#endif




void 					soft_timer_manual_register(unsigned char id, event_t evt);
unsigned char	soft_timer_auto_register(event_t evt, unsigned char auto_unregister);
void soft_timer_start(unsigned char id, soft_timer_t timeout);
void soft_timer_stop(unsigned char id);
void soft_timer_clear();//stop all
void soft_timer_reset();//unregister all
void soft_timer_pulse();
void soft_timer_pull();	//call in main thread loop

#define soft_timer_unregister(id)									soft_timer_manual_register(id, 0)

//for backward compactibility
#define soft_timer_register(id,evt)								soft_timer_manual_register(id,evt)



#endif /* SOFT_TIMER_H */